<%-- 
    Document   : create
    Created on : 2014-10-13, 16:10:50
    Author     : ppc
--%>

<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include  file="/WEB-INF/jspf/import.jspf"%>
<div class="pageContent">
    <form method="post" action="${ROOT}/admin/medal/${empty clubMedal?"create":"update"}.do" 
          class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone);">
        <div class="pageFormContent" layoutH="56">
            <dl class="nowrap">
                <dt>勋章名称：</dt>
                <dd><input type="text" class="required" name="name" value="${clubMedal.name}"></dd>
            </dl>
            
            <dl class="nowrap"><dt>缩略图:</dt><dt><img src="${clubMedal.url}"  id="showUrl" width="34" height="34"/></dt></dl>
            <dl class="nowrap">
                <dt>勋章图片：</dt>
                <div class="btn" id="upPhoto" style="display:inline-block; width:80px; height:22px; background:url(http://www1.pcauto.com.cn/bbs/cargroup/2014/images/index_sprite.png) no-repeat scroll -267px -131px; margin-right:10px; vertical-align:middle; overflow: hidden; "><div id="spanButtonPlaceholder" class="addBtn"></div>
                                    <ul class="pic" id="divFileProgressContainer"></ul>
                               </div>
                <input type="hidden" name="url" class="required" id="url" value="${clubMedal.url}"/>
                <input type="hidden" name="medalId" value="${clubMedal.medalId}"/>
            </dl>
        </div>
        <div class="formBar">
            <ul>
                <li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
                <li><div class="button"><div class="buttonContent"><button class="close" type="button">关闭</button></div></div></li>
            </ul>
        </div>
    </form>
</div>
<jsp:include page="/admin/medal/photo_upload.jsp"></jsp:include>
<script type="text/javascript">
    // 初始化上传组件
    initswfu();
    function fileCallback(json){
        if(json.retCode == 0) {
            var fls = json.files;
            var url = "";
            var showUrl="";
            for(var i =0;i<fls.length;i++){
                if(fls[i].url.indexOf("_34")!=-1){
                    url = fls[i].url;
                    showUrl=fls[i].url;
                }
            }
            $("#url").val(url);
            $("span[for='url']").hide();
            $("#showUrl").attr("src",showUrl);
            $("#showUrl").show();
        }
    }
</script>